<template>
  <div class="goodsIntroduce">
    <div class="top">
      <div class="line"></div>
      <div class="gou">
        <img
          src=""
          alt=""
        />
      </div>
      <h2>根据您的偏好猜您可能喜欢</h2>
      <div class="line"></div>
    </div>
    <div class="bottom">
      <div
        class="item"
        v-for="(item, index) in goodslist"
        :key="index"
        @click="
          $router.push({ path: '/goodDetail', query: { id: item.product_id } })
        "
      >
        <img :src="item.image_url" />
        <p class="name">{{ item.cont }}</p>
        <div>
          <span
            :class="{ acvive: i.name == '自营' || i.name == '包邮' }"
            v-for="(i, j) in item.product_tags"
            :key="j"
            >{{ i.name }}</span
          >
        </div>
        <p class="price">￥{{ item.price }}</p>
        <p class="evaluate">{{ item.review_count }}人评价</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      goodslist: [],
    };
  },
  created() {
    this.goodslist = require("../../../public/jSON/car");
  },
};
</script>

<style lang="less" scoped>
.goodsIntroduce {
  // margin-bottom: 200px;
  // padding-bottom: 100px;
  .top {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    height: 50px;
    border-top: 1px solid rgba(153, 153, 153, 0.164);
    h2 {
      font-size: 15px;
      text-align: center;
    }
    .gou {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      text-align: center;
      font-size: 18px;
      margin-right: 5px;
      img {
        width: 22px;
      }
    }
    .line {
      width: 40px;
      height: 1px;
      background-color: #999;
      margin: 0px 10px;
    }
  }
  .bottom {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0px 5px;
    box-sizing: border-box;
    .item {
      width: 49%;
      background-color: white;
      border-radius: 10px;
      overflow: hidden;
      margin-bottom: 5px;
      padding-top: 5px;
      img {
        width: 100%;
        height: 150px;
        border-radius: 10px;
        box-sizing: border-box;
        margin: 0 auto;
        margin-bottom: 5px;
      }
      div {
        margin-left: 10px;
        span {
          display: inline-block;
          border: 1px solid transparent;
          font-size: 12px;
          color: white;
          padding: 0px 2px;
          border-radius: 4px;
          background-color: red;
          margin-right: 2px;
          &.acvive {
            color: red;
            border: 1px solid red;
            background-color: white;
          }
        }
      }
      p {
        text-indent: 10px;
        margin: 5px 0px;
      }
      .name {
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 14px;
        white-space: nowrap;
      }
      .price {
        font-size: 14px;
        color: red;
      }
      .evaluate {
        font-size: 12px;
        color: #999;
      }
    }
  }
}
</style>